﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace 代码生成器基础
{
    class Program
    {
        static void Main(string[] args)
        {
           // string s1 = @"c:\aa";
           // string s2 = "1.jpg";

           //string s3 = Path.Combine(s1, s2);
           //Console.WriteLine(s3);
            //string s3;
            //if (s1.EndsWith("/"))
            //{
            //    s3 = s1 + s2;
            //}
            //else
            //{
            //    s3 = s1 + "/" + s2;
            //}
            ////string s3 = s1 +"/"+ s2;
            //Console.WriteLine(s3);


            //创建文件夹
            //把第二个参数字符串内容写到第一个字符串指定的文件中
            Directory.CreateDirectory(@"c:\a\");//如果文件夹不存在就创建
            File.WriteAllText(@"c:\a\1.txt","hello\r\n哈哈");
            Directory.CreateDirectory(@"c:\b\w2\ddd");

            //string s = "";
            //s += "using aaaa;\r\n";
            //s += "using Sytem.Data;\r\n";
            //s += "using Sytem.xml;\r\n";

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("fafasdfasfasd");//每次AppendLine的内容都另起一行
            sb.AppendLine("3333333");//注意是AppendLine方法，别用错了
            sb.AppendLine("435435344343");
            string code = sb.ToString();//转换成字符串
            File.WriteAllText(@"c:\1.txt", code);
            Console.ReadKey();
        }
    }
}
